package org.msfj.common.submail;

import org.msfj.common.util.SubMailUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.msfj.common.submail.SubmailConfig.PREFIX;

/**
 * @Description:
 * @Author: like
 * @Date: 2017-10-27 12:34
 * @Version: 1.0
 * @Created in idea by autoCode
 */
@Configuration
@EnableConfigurationProperties(SubmailConfig.class)
@ConditionalOnProperty(prefix = PREFIX, name = "enabled", havingValue = "true")
public class SubmailAutoConfig {

    @Bean
    public SubMailUtil subMailUtil(SubmailConfig submailConfig) {
        return new SubMailUtil(submailConfig);
    }
}
